package ch2;

import java.util.*;

import ch1.Person;

public class List3 {

	public static void main(String[] args) {
		// 加上泛型

		List<String> list = new Vector<>();
		list.add("dog");
		list.add("cat");
		list.add("4");
		list.add("4.24");

		String st = list.get(3);
		System.out.println(st);
		for (String s : list)
			System.out.println(s);
		System.out.println(">>>>>>>>>>>>>>>>>>");

		Map<String, Person> m = new HashMap<>();
		m.put("最拽", new Person("许鹏", 21, "男"));
		m.put("最高", new Person("李凯", 29, "男"));
		m.put("最乖", new Student("丁鹏飞", 23, "男"));

		Person s = m.get("最乖");
		System.out.println("最乖的是：" + s);
		System.out.println("迭代Map");
		Set<String> sk = m.keySet();
		for (String s1 : sk) {
			Person p = m.get(s1);
			System.out.println(p);
		}

		List<Person> p = new ArrayList<>();
		p.add(new Person("许鹏", 21, "男"));
		p.add(new Person("许2鹏", 24, "男"));
		p.add(new Person("许3鹏", 25, "男"));

		Set<Person> s2 = new HashSet<>();
		p.add(new Person("汪翔", 22, "男"));
		p.add(new Student("小吴", 32, "女"));
		p.addAll(s2);
		System.out.println(p);// containsAll
	}

}
